package com.gzz.manage.sys.func;

import org.springframework.stereotype.Repository;

import com.gzz.common.base.BaseDao;

/**
 * @类说明 【功能菜单】数据访问层
 * @author 高振中
 * @date 2020-11-10 23:19:07
 **/
@Repository
public class FuncDao extends BaseDao {
 
	/**
	 * @方法说明 修改上级结点为非叶子(delete)
	 */
	public int updateParentDelete(int id) {
		String sql = "UPDATE sys_func SET leaf=(SELECT c FROM (SELECT IF (count(1)=0,1,0) c FROM sys_func WHERE parentId=?) a) WHERE funcId=?";
		return update(sql, id, id);
	}

	/**
	 * @方法说明 修改上级结点为非叶子(save)
	 */
	public int updateParentSave(int id) {
		String sql = "UPDATE sys_func SET leaf=0 WHERE funcId=? ";
		return update(sql, id);
	}

}